<template>

		
		<view class="formlogin">
		        <view>
			<image src="../../static/QQ截图20240111144239.png" style="max-height: 300rpx;"></image>
		        </view>
		        <view style=" display: flex; justify-content: center;align-items: center;font-weight: bold;color:#A6876B;margin: 50rpx">
			      注册你的账号
			    </view>
				<view>
					<input type="text" placeholder="昵称" name="userText" v-model="userText" style="border-bottom: 1rpx solid #DEDEDE;margin: 50rpx;"/>
				</view>
				<view>
					
					<input type="password" placeholder="请输入密码" name="pwdText" v-model="pwdText" style="border-bottom: 1rpx solid #DEDEDE;margin: 50rpx;"/>
				</view>
				<view>
					
					<input type="text" placeholder="请输入邮箱地址" name="emailText" v-model="emailText" style="border-bottom: 1rpx solid #DEDEDE;margin: 50rpx;"/>
				</view>
				
				<view>
					<button @click="reg" style="width: 40%;align-items: center;background-color: #A6876B;;">立即注册</button>
				</view>
			
	    </view>
</template>

<script>
	export default {
		data() {
			return {
				userText:'',
				pwdText:'',
				emailText:''
			}
		},
		methods: {
			reg:function(){
				var that=this;
				// 获取输入信息
				console.log(this.userText);
				console.log(this.pwdText);
				uni.request({
					url:"http://localhost:8888/register",
					method:'POST',
					data:{
						userText:this.userText,
						pwdText:this.pwdText,
						emailText:this.emailText
					},
					success:function(res){
						console.log(res.data.message)
						if(res.data.code == 200) {
							uni.showToast({
								title:res.data.message,
								icon:"success"
							});
							setTimeout(() => {
							        // 在这里设置跳转的逻辑
							        uni.navigateTo({
							          url:"/pages/login/login" // 替换成你要跳转的页面路径
							        });
							      }, 1000); // 设置延迟时间，单位为毫秒（这里设置为2秒）
						}else {
							uni.showToast({
								title:res.data.message,
								icon:'error'
							});
						}
						
					}
				});
			}
			
		}
	}
</script>

<style>
	.formLogin{
		display: flex;
		flex-direction: row;
		justify-content: center;
		
	}
	.formLogin>view:nth-child(2){
		
	}
	.formLogin>view{
		display: flex;
		align-items: center;
		margin-bottom: 50px;
		
	}
	
	
	.formLogin>view:nth-child(6) button{
		width: 80%;
		border-radius: 40px;
		background-color: greenyellow;
		color: white;
	}
	.formLogin{
		padding: 45px;
	}
	
</style>
